//
// Example showing how to disable FLTK symbols globally
// erco 05/31/2005
//
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Button.H>
#include <FL/fl_draw.H>
static int G_usesymbols = 1;

// Global FLTK callback for drawing all label text
void MyDraw(const Fl_Label *o, int X, int Y, int W, int H, Fl_Align a) {
  fl_font(o->font, o->size);
  fl_color((Fl_Color)o->color);
  fl_draw(o->value, X, Y, W, H, a, o->image, G_usesymbols);
}

// Global FLTK callback for measuring all labels
void MyMeasure(const Fl_Label *o, int &W, int &H) {
  fl_font(o->font, o->size);
  fl_measure(o->value, W, H, G_usesymbols);
}

// Turn symbols on or off
void FltkUseSymbols(int onoff) {
  G_usesymbols = onoff;
  Fl::set_labeltype(FL_NORMAL_LABEL, MyDraw, MyMeasure);   // real action here
}

// Button callback to toggle symbols on/off
void Button_CB(Fl_Widget*,void*data) {
  FltkUseSymbols(G_usesymbols ? 0 : 1);
  Fl_Window *win = (Fl_Window*)data; win->redraw();
}
int main() {
  Fl_Double_Window win(0,0,400,200);
  Fl_Choice choice(100,10,120,25,"Email@3Dsite");
  choice.add("abc@->");
  choice.add("ABC@<-");
  choice.value(0);
  Fl_Button butt(100,45,120,25,"Toggle Symbols");
  butt.callback(Button_CB, (void*)&win);
  win.resizable(win);
  win.show();
  return(Fl::run());
}
    
